/**
 * 
 */
package com.org.javabody.ListApi.linkedList;

import java.util.LinkedList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;



/**

 * list.set()方法时将某一位置的字段替换为指定字段，位置是从0开始算起

 * list.add()方法是将某一位置的前插入指定字段

 * @author Administrator

 *

 */
public class LinkedListDemo {
	private final static Logger log = LoggerFactory.getLogger(LinkedListDemo.class); 
	public List<String> setList(){
		List<String> list = new LinkedList<String>();
		list.add("A");
		list.add("b");
		list.add("D");
		list.add("E");
		list.add("G");
		return list;
	}
	/**

	 * @param args

	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub


		

		List<String> list = new LinkedListDemo().setList();	
		Long a = System.currentTimeMillis();
		list.set(1, "B");//ABDEG

		list.add(2, "C");//ABCDEG

		list.add(5, "F");
		log.info(list+"");
		try {
			Thread.sleep(3000);//先挂起3s再往下执行

		} catch (InterruptedException e) {
			// TODO Auto-generated catch block


			e.printStackTrace();
		}
		Long b = System.currentTimeMillis();
		log.info((b-a)+"ms");
	}
}
